package org.vsb.chmireader.spring.configuration;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AppConfiguration {
	
	/**
	 * List of stations(nodes) and its names. Do not duplicate!
	 * @return
	 */
	@Bean
    public List<NodeInfo> nodeList(){
        List<NodeInfo> aList = new ArrayList<>();
        aList.add(new NodeInfo("Studenka","http://portal.chmi.cz/files/portal/docs/uoco/web_generator/aqindex_slide3/mp_TSTDA_CZ.html"));
        aList.add(new NodeInfo("Ostrava-Poruba","http://portal.chmi.cz/files/portal/docs/uoco/web_generator/aqindex_slide3/mp_TOPOA_CZ.html"));
        aList.add(new NodeInfo("Ostrava-Zabreh","http://portal.chmi.cz/files/portal/docs/uoco/web_generator/aqindex_slide3/mp_TOZRA_CZ.html"));
        aList.add(new NodeInfo("Ostrava-MarianskeHory","http://portal.chmi.cz/files/portal/docs/uoco/web_generator/aqindex_slide3/mp_TOMHK_CZ.html"));
        aList.add(new NodeInfo("Ostrava-Fifejdy","http://portal.chmi.cz/files/portal/docs/uoco/web_generator/aqindex_slide3/mp_TOFFA_CZ.html"));
        aList.add(new NodeInfo("Ostrava-Privoz","http://portal.chmi.cz/files/portal/docs/uoco/web_generator/aqindex_slide3/mp_TOPRA_CZ.html"));
        aList.add(new NodeInfo("Ostrava-Ceskobratrska","http://portal.chmi.cz/files/portal/docs/uoco/web_generator/aqindex_slide3/mp_TOCBA_CZ.html"));
        aList.add(new NodeInfo("Ostrava-Radvanice","http://portal.chmi.cz/files/portal/docs/uoco/web_generator/aqindex_slide3/mp_TOREK_CZ.html"));
        return aList;
	}
	
	/**
	 * Timeout for connection while trying to connect to the station
	 * @return
	 */
	@Bean
	public Integer configuredTimeout(){
		return 6000;
	}
	
	/**
	 * How much times app will try to read data
	 * @return
	 */
	@Bean
	public Integer numerOfAttempts(){
		return 5;
	}

}
